package cn.com.bluemoon.daps.common.sql.layer;

import com.alibaba.druid.DbType;

/**
 * @author Jarod.Kong
 * @date 2021/1/21 15:15
 */
public abstract class AbstractLayerCheck implements ILayerCheck {
    protected ILayerCheck layerCheck;

    public AbstractLayerCheck() {
        this.layerCheck = new DruidLayerCheck();
    }

    public AbstractLayerCheck(ILayerCheck layerCheck){
        this.layerCheck = layerCheck;
    }

    /**
     * 解析SQL（单条）
     *
     * @param dbType
     * @param sql
     * @return
     */
    @Override
    public void checkSingle(DbType dbType, String sql, LayerCallback callback) {
        layerCheck.checkSingle(dbType, sql, callback);
    }



    /**
     * 解析SQL（多条）
     *
     * @param dbType
     * @param sqls   多条（select 1 ; select 2)
     * @return 整条语句结果
     */
    @Override
    public void check(DbType dbType, String sqls, LayerCallback callback) {
        layerCheck.check(dbType, sqls, callback);
    }
}
